package com.sls.mall.product.web;

import com.sls.mall.product.service.SkuInfoService;
import com.sls.mall.product.vo.SkuItemVO;
import lombok.SneakyThrows;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.concurrent.ExecutionException;

/**
 * @author lixue
 * @Title: ItemController
 * @ProjectName sls_mall2021
 * @Description: TODO
 * @date 2021/5/417:01
 */
@Controller
public class ItemController {

    @Autowired
    SkuInfoService skuInfoService;


    @GetMapping("/{skuId}.html")
    public String skuItem(@PathVariable("skuId") Long skuId, Model model) throws ExecutionException, InterruptedException {
        System.out.println(skuId);

        SkuItemVO skuItemVO = skuInfoService.item(skuId);

        model.addAttribute("item",skuItemVO);

        return "item";
    }

}
